
Partial Class SAD_SADQScan
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If IsPostBack = False Then
            '---Populate list of scan types
            cmbType.Items.Add(New ListItem("Schema Scan", SQLAutoDocLib.ScanSchedule.Type.SchemaScan))
            cmbType.Items.Add(New ListItem("Size Scan", SQLAutoDocLib.ScanSchedule.Type.SizeScan))
            cmbType.Items.Add(New ListItem("Block Scan", SQLAutoDocLib.ScanSchedule.Type.BlockScan))
            cmbType.Items.Add(New ListItem("Connection Scan", SQLAutoDocLib.ScanSchedule.Type.ConnectionScan))
            cmbType.Items.Add(New ListItem("Wait State Scan", SQLAutoDocLib.ScanSchedule.Type.WaitStateScan))

            '---Populate list of databases
            Dim oServerFactory As New SQLAutoDocLib.Server_Factory
            Dim oDBFactory As New SQLAutoDocLib.Database_Factory
            For Each oServer As SQLAutoDocLib.Server In oServerFactory.AllActiveServers
                For Each oDB As SQLAutoDocLib.Database In oDBFactory.GetAllDatabasesForServer(oServer.ID)
                    cmbDatabase.Items.Add(New ListItem(oServer.Name & "." & oDB.Name, oDB.ID))
                Next
            Next
        Else
            Dim oScan As New SQLAutoDocLib.Scanner
            If Request.Form(cmdScan.UniqueID) > "" Then
                oScan.Queue_ScanDatabase()

            ElseIf Request.Form(cmdScanForType.UniqueID) > "" Then
                oScan.Immediate_ScanDatabase(cmbDatabase.Value, cmbType.Value)
            End If
        End If
    End Sub
End Class
